#ifndef WIDGET_H
#define WIDGET_H

#include <QWidget>
#include <qpixmap.h>
#include <qdebug.h>
#include <qdatetime.h>
#include "gamer.h"
#include <qlist.h>
class QTextBrowser;
class Timer;
class Replay;
class Map;
class Widget : public QWidget
{
    Q_OBJECT
public:
    explicit Widget(QWidget *parent = 0);
	~Widget();
	void draw();
	void start();
    void wol(bool pw);
    void setVT(QTextBrowser *p,Timer* ta,Timer* tb);
signals:
    void changetimer();
    void stoptimer();
    void isReady(bool);
public slots:
	void over(int si,int sj,int ei,int ej);
    void onundo();
    void onload();
    void onsave();
private:
    QDateTime datetime;
    QTextBrowser *viewer;
    Timer *t1,*t2;
	QPixmap map;
    bool started,autosave;
	Map *a;
	int totalstep;
	QList<Steps> steps;
	QList<Steps> steps2;
	void paintEvent(QPaintEvent *);
    void mouseMoveEvent(QMouseEvent *);
	void mousePressEvent(QMouseEvent *);
	Gamer *game;
	bool waiting;
	bool selected;
	int mi,mj,ti,tj;
	bool color;
	bool winorlose();
	void reset();
	Replay *r;
	bool replay;
private slots:
	void onprev();
	void onnext();
	void onfrist();
	void onlast();
	void error();
};

#endif // WIDGET_H
